package edu.qqilin.springframework.test.common;

import edu.qqilin.springframework.beans.BeansException;
import edu.qqilin.springframework.beans.factory.config.BeanPostProcessor;
import edu.qqilin.springframework.test.bean.UserService;

/**
 * Description: new java files header..
 *
 * @author qqilin1213
 * @version 1.0
 * @date 2025/11/24 21:01
 */
public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if ("userService".equals(beanName)) {
            UserService userService = (UserService) bean;
            userService.setLocation("改为：北京");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }
}
